/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package factura.modelo;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author usuario
 */
@Entity
@Table(name = "iva",catalog = "postgres", schema = "facturacion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Iva.findAll", query = "SELECT i FROM Iva i"),
    @NamedQuery(name = "Iva.findById", query = "SELECT i FROM Iva i WHERE i.id = :id"),
    @NamedQuery(name = "Iva.findByValor", query = "SELECT i FROM Iva i WHERE i.valor = :valor")})
public class Iva extends ClavePrimaria {

    private static final long serialVersionUID = 1L;
    private double valor;

    public Iva() {
    }

    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    @Override
    public Integer getId() {
        return id;
    }

    public Iva(Integer id, double valor) {
        this.id = id;
        this.valor = valor;
    }

    @Basic(optional = false)
    @Column(name = "valor")
    public double getValor() {
        return valor;
    }

    public void setValor(double valor) {
        this.valor = valor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Iva)) {
            return false;
        }
        Iva other = (Iva) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pruebajpa.Iva[ id=" + id + " ]";
    }
}
